<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title>Test CF_Table Classes</title>
		<link type="text/css" href="css/humanity/jquery-ui-1.8.9.custom.css" rel="stylesheet" />	
		<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
		<script type="text/javascript" src="js/jquery-ui-1.8.9.custom.min.js"></script>
		<script type="text/javascript" src="../CF_JS/CF_SyncVal.js"></script>
	</head>
	<body>
		<?php
include_once 'boot.php';
//include_once 'employees_fields.php';
include_once 'employees_spec.php';
?>

<pre>

<?php
$ar_data = get_array_query_full("SELECT * FROM employees");

class TestTable extends CF_TableActCol {


}

$ttall =  new TestTable('All',$ar_data,'test_all_table');
$ttall_html = $ttall->maketable();
print "Default Spec \n";
print_r($ttall->fieldspec);
?>
</pre>
<table>
<?php

print $ttall_html;
?>
</table>

<pre>
<?php
print 'SPEC' . "\n";
print_r($employees_spec);
//print_r($fieldspec);
// testing lookup manually... I will use the fieldspec class
//$lr = new CF_LookupResolver;
//$lr->static_spec['officeCode']=array(0=>array('keyvalue'=>0,'showvalue'=>'none'));
//$lr->query_spec['officeCode']['query'] = "SELECT officeCode AS keyvalue, city AS showvalue FROM offices WHERE 1 ";
//$lr->query_spec['officeCode']['orderby'] = array('city'=>'ASC');
//$list = $lr->GetList('officeCode');

$fs = new CF_FieldSpec($employees_spec);
//$fs = new CF_FieldSpec($fieldspec);

$lr = new CF_LookupResolver;

$fs->SetupLookupResolver($lr);

$list = $lr->GetList('officeCode');
$reports_list = $lr->GetList('reportsTo');


$tt = new TestTable($employees_spec,$ar_data,'testtable');
//$tt = new TestTable($fieldspec,$ar_data,'testtable');

$tt->set_lookup('officeCode',$list);

print "data \n";
print_r($tt->valuesarray);
print "Lookup List for officeCode:\n";
print_r($tt->ar_lookups['officeCode']);
print "\n index\n";
print_r($tt->ar_index_lookups);

$tt->set_url('delete',$url = 'http://www.yahoo.com',$method = 'post',$params = array('mode'=>'Delete'), $caption = 'TestDelete');
$tt->set_url('edit',$url = 'http://www.yahoo.com',$method = 'get',$params = array('mode'=>'Edit'), $caption = 'TestEdit');


$tt_html = $tt->maketable();

?>

<table>
<?php
print $tt->make_simple_heading();
print $tt_html;

?>


</table>
</pre>
<?php
class TestInlineTable extends CF_TableAjUpdate {


}


$tt_it = new TestInlineTable($employees_spec,$ar_data,'testtable');
//$tt_it = new TestInlineTable($fieldspec,$ar_data,'testtable');
$tt_it->set_lookup('officeCode',$list);
$tt_it->set_lookup('reportsTo',$reports_list);
print "\n Lookups \n";
print_r($tt_it->ar_index_lookups);
$tt_it_html = $tt_it->maketable();
?>

<table>
<script type="text/javascript">
<?php print $tt_it->make_supportJS() ?>
</script>
<?php print $tt_it_html; ?>
</table>
</body>
</html>